<!doctype html>
<html lang="zh-Hans-CN">

	<head>
		<title></title>
		<meta charset="utf-8">
		<meta name="keywords" content="">
		<meta name="description" content="">
		<meta name="author" content="chen">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1">
		<!--<link rel="stylesheet" type="css/text" media="screen and ( min-width: 1200px )" href="">-->
		<link rel="stylesheet" type="text/css" media="screen" href="">
		<script defer="defer" src=""></script>
		<style>
			/*@import url("css/name.css") screen and ( min-width: 1200px );*/
		</style>
	</head>
	
	<body>
		<button id='btn'>点击下载</button>
		<script>
			let btn = document.getElementById('btn');
			btn.onclick = function() {
				// 创建一个<a>元素
				let link = document.createElement('a');
				// 设置<a>元素的URL
				link.href = './data/text.txt';
				// 设置用户下载的文件的命名
				link.download = '文本文件.txt';
				// 激活链接
				link.click();
			}
		</script>
	</body>

</html>